import request from "@/utils/request"

//定义请求返回的值的类型
export interface reqLoginType {
  token: string
}

//定义获取用户信息的返回值类型
export interface reqUserInfoType {
  routes: string[]
  buttons: string[]
  roles: string[]
  name: string
  avatar: string
}

//1.登录请求
export const reqLogin = (username: string, password: string) => {
  return request.post<null, reqLoginType>(`/admin/acl/index/login`, {
    username,
    password,
  })
}

//2.请求用户信息
export const reqUserInfo = () => {
  return request.get<null, reqUserInfoType>(`/admin/acl/index/info`)
}

//3.退出登录
export const reqLogout = () => {
  return request.post<null, null>(`/admin/acl/index/logout`)
}
